home *** CD-ROM | disk | FTP | other *** search
/ Acorn User: China / Acorn User China CD-ROM (UK) (Disc A) / Acorn User China CD-ROM (UK) (Disc A).bin / HENSA / DISKMANAGER / PCDIR.ARC / !PCDir_TEXTS_table < prev   
Encoding:
Text File  |  1990-06-13  |  8.5 KB  |  136 lines

  1. /***************************************************************************/
  2. /*                                                                         */
  3. /*     Program to Produce Conversion Table for PCDir                       */
  4. /*                                                                         */
  5. /***************************************************************************/
  6. /*                                                                         */
  7. /*                                                                         */
  8. /*   You should not alter the PCDir Config file unless you are confident   */
  9. /*   you understand what you are doing. PCDir makes no checks on the       */
  10. /*   consistency or validity of the config file, it assumes that the       */
  11. /*   config file is correct. In particular the number of items in the      */
  12. /*   header must be correct. PC File Extensions should only contain        */
  13. /*   valid characters.                                                     */
  14. /*                                                                         */
  15. /*   PCDir uses the config file as follows                                 */
  16. /*                                                                         */
  17. /*   When converting files ADFS to PC the PC file extension is found by    */
  18. /*   searching the table for the first matching ADFS filetype. The PC      */
  19. /*   file extension is the corresponding entry in the table. If            */
  20. /*   un-matched the file type is taken as DAT ( For Data ).                */
  21. /*                                                                         */
  22. /*   Similarly for files being converted PC to ADFS the first entry with   */
  23. /*   a matching extension. Will cause the filetype to be set to the        */
  24. /*   relevant entry.                                                       */
  25. /*                                                                         */
  26. /*   In either case, CR/LF processing is carried out according to the      */
  27. /*   process flag.                                                         */
  28. /*                                                                         */
  29. /*   Fields maker NYU are Not Yet Used                                     */
  30. /*                                                                         */
  31. /*   If you regularly move program source between PC diskettes and ADFS    */
  32. /*   then you may well wish to change the filetypes for the associated     */
  33. /*   source type. e.g.  change the filetype for C to a user filetype.      */
  34. /*   Then moving the file back to a PC Diskette will preserve the          */
  35. /*   file extension of C. ( rather than TXT as is the default  ).          */
  36. /*                                                                         */
  37. /***************************************************************************/
  38.  
  39. #include <stdio.h>
  40. #include <string.h>
  41.  
  42. typedef struct {
  43.      char  pcdrive;          /* PC Drive ( Will be overrided by PC$Drive ) */
  44.      char  prompt;           /* Non-Zero causes insert disk prompts        */
  45.      char  step[3];          /* Default steps for floppies  ( 1 or 2 ) NYU */
  46.      int   items;            /* Number of conversion table entries         */
  47.         } hdr;
  48.  
  49. typedef struct {             /* Table record Structure                     */
  50.      int  type;              /* ADFS file type                             */
  51.      char ext[3];            /* PC File extension                          */
  52.      char flag;              /* Bit 0  CRLF Processing                     */
  53.      } rec;
  54. /*---    Global Variables                                               ---*/
  55. FILE *fp;
  56.  
  57. /**************************************************************************/
  58. /*                                                                        */
  59. /*       Add Table Entry                                                  */
  60. /*                                                                        */
  61. /*       parameters :-                                                    */
  62. /*                     ADFS File type                                     */
  63. /*                     IBM  File Extension                                */
  64. /*                     Process                                            */
  65. /*                             0  Straight copy                           */
  66. /*                             1  CRLF Processing                         */
  67. /*                                                                        */
  68. /**************************************************************************/
  69. void add_entry(int t,char *s,int f)
  70. {
  71. rec record;
  72.  
  73. record.type  = t;                       /* Copy filetype to record          */
  74. strcpy(record.ext,s);                   /* Copy Extension to record         */
  75. record.flag  = f;                       /* Copy conversion flag to record   */
  76. fwrite(&record,sizeof(record),1,fp);    /* write out record                 */
  77. }
  78.  
  79. /**************************************************************************/
  80. /*                                                                        */
  81. /*                Main function : create config file                      */
  82. /*                                                                        */
  83. /**************************************************************************/
  84. int main(void)
  85.  
  86. {
  87. char *filename = ":4.Probation.!PCDir.Config";  /* Target file name       */
  88. hdr header;                                     /* File header            */
  89.  
  90. fp = fopen(filename,"w");                       /* Open file              */
  91. /**************************************************************************/
  92. /*                                                                        */
  93. /*                      Setup Header                                      */
  94. /*                                                                        */
  95. /**************************************************************************/
  96. header.pcdrive = 0;               /* Default PC Drive ( PC$Drive overides */
  97. header.prompt  = 0;               /* Prompt for Disk Insert 0 or 1        */
  98. header.step[0] = 1;               /* Default Step for drive 0             */
  99. header.step[1] = 1;               /* Default Step for drive 1             */
  100. header.step[2] = 1;               /* Default Step for drive 2             */
  101. header.items   = 19;              /* Number of table entries : max 25     */
  102.  
  103. fwrite(&header,12,1,fp);          /* Write out header                     */
  104.  
  105. /**************************************************************************/
  106. /*                                                                        */
  107. /*                      Table entries                                     */
  108. /*                                                                        */
  109. /**************************************************************************/
  110. add_entry(0xFFF,"TXT",1);         /*  Text                             1  */
  111. add_entry(0xDDC,"ARC",0);         /*  Arc Archives                     2  */
  112. add_entry(0xFF5,"PS ",0);         /*  Post Script                      3  */
  113. add_entry(0xDEA,"DXF",1);         /*  DXF  Files                       4  */
  114. add_entry(0xFFB,"BAS",0);         /*  Basic                            5  */
  115. add_entry(0xFF8,"FF8",0);         /*  Applications                     6  */
  116. add_entry(0xFFF,"C  ",1);         /*  C Source                         7  */
  117. add_entry(0xFFF,"H  ",1);         /*  H Headers                        8  */
  118. add_entry(0xFFF,"SCR",1);         /*  Script                           9  */
  119. add_entry(0xFFF,"DOC",1);         /*  Documentation                   10  */
  120. add_entry(0xFFF,"ME ",1);         /*  ReadMe files                    11  */
  121. add_entry(0xFFF,"PAS",1);         /*  Pascal Source                   12  */
  122. add_entry(0x405,"GMF",0);         /*  Graphics Metafile for !DrwCgm   13  */
  123. add_entry(0x405,"CGM",0);         /*  Graphics Metafile for !DrwCgm   14  */
  124. add_entry(0x695,"GIF",0);         /*  Graphics Interchange File       15  */
  125. add_entry(0xAFF,"AFF",0);         /*  Draw File                       16  */
  126. add_entry(0xFF0,"TFF",0);         /*  Tiff File                       17  */
  127. add_entry(0xDB0,"WK1",0);         /*  Lotus 1-2-3 file                18  */
  128. add_entry(0xDB0,"WKS",0);         /*  Lotus 1-2-3 file                19  */ 
  129. /**************************************************************************/
  130. /*                   Non Standard Table Entries                           */
  131. /**************************************************************************/
  132.  
  133. fclose(fp);                       /*  Close File                          */
  134. return(0);
  135. }
  136.